﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Script.Services;
using STC.Thietbi.Web.User;

namespace STC.Thietbi.Web.WS
{
    /// <summary>
    /// Summary description for UserService
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    [ScriptService]
    public class UserService : System.Web.Services.WebService
    {

        [WebMethod]
        public string HelloWorld(string id)
        {
            return "Hello World";
        }
        [WebMethod(EnableSession = true)]
        [ScriptMethod]
        public IEnumerable<dynamic> GetListCompanies()
        {
            //Companies lstCompanies = new STCControllers().GetObjectById<Companies>(new ObjectId(), Constants.Collections.COMPANY);
            List<Companies> lst = new List<Companies>();
            Companies item = new Companies();
            
            item = new Companies();
            item.Id = 1;
            item.Name = "Công ty Thăng Long";
            item.Address = "Phú Thọ";
            item.Email = "tl@gmail.com";
            lst.Add(item);

            item = new Companies();
            item.Id = 2;
            item.Name = "Công ty Than Khoáng sản";
            item.Address = "Quảng Ninh";
            lst.Add(item);


            return lst.ToList<dynamic>();
        }
    }
}
